﻿<div class="monthly-report-container">
    <div class="row">
        <div class="col-xs-4">
            <h3><strong>MONTHLY REPORT</strong></h3>
        </div>
        <div class="col-xs-3">
            <h3>
                Report Date: <a style="display:inline-block; margin:0;" href="#" editable-date="currentDate" buttons="no" blur="submit" e-name="currentDate">{{currentDate | date: 'dd/MM/yyyy'}}</a>
            </h3>
        </div>
        <div class="col-xs-3"><h3>by: {{fullName}}</h3></div>
        <div class="col-xs-1"><button class="btn btn-info navbar-btn hidden-print" ng-click="doPrint()"><i class="glyphicon glyphicon-print"></i> Print</button></div>
    </div>
    <div>
        <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th>
                        Statistic by Month
                    </th>
                    <th>
                        Jan
                    </th>
                    <th>
                        Feb
                    </th>
                    <th>
                        March
                    </th>
                    <th>
                        April
                    </th>
                    <th>
                        May
                    </th>
                    <th>
                        June
                    </th>
                    <th>
                        July
                    </th>
                    <th>
                        August
                    </th>
                    <th>
                        Sept
                    </th>
                    <th>
                        October
                    </th>
                    <th>
                        November
                    </th>
                    <th>
                        December
                    </th>
                    <th>
                        <a href="#" editable-text="year" buttons="no" blur="submit" e-name="year" onaftersave="viewReports(year)">{{year}}</a>
                    </th>
                </tr>
            </thead>
            <tbody ng-show="monthlyReport.length">
                <tr>
                    <td>Total Quotes</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfQuote }}</tdclass>
                </tr>
                <tr>
                    <td>Total PO</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfPO }}</td>
                </tr>
                <tr>
                    <td>Total Failed Quotes</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfQuote - report.noOfPO }}</td>
                </tr>
                <tr>
                    <td>Total WO</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfWO }}</td>
                </tr>
                <tr>
                    <td>Total Failed PO</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfPO - report.noOfWO }}</td>
                </tr>
                <tr>
                    <td>Total Certificates</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfCert }}</td>
                </tr>
                <tr>
                    <td>Total Equipt Calibrated</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfEquipmentCalibrated }}</td>
                </tr>
                <tr>
                    <td>Equipt Calibrated by Vendor</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfEquiptCalibratedByVendors }}</td>
                </tr>
                <tr>
                    <td>New Customer</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfNewCustomer }}</td>
                </tr>
                <tr>
                    <td>Standards dues</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.noOfStandardsDues }}</td>
                </tr>
                <tr>
                    <td class="landing-row" colspan="{{1 + monthlyReport.length}}"></td>
                </tr>
                <tr>
                    <td>Total Invoice Value</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.totalInvoiceValue | number}}</td>
                </tr>
                <tr>
                    <td>Total PO Value</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">{{ report.totalPOValue | number}}</td>
                </tr>
                <tr>
                    <td>Operation expenses</td>
                    <td class="text-right" ng-repeat="report in monthlyReport | limitTo: monthlyReport.length - 1">
                        <a href="#" editable-text="report.operationExpenses" buttons="no" blur="submit">{{ report.operationExpenses || 0 | number}}</a>
                    </td>
                    <td class="text-right">
                        {{sumOE(monthlyReport)|| 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td>Total AE</td>
                    <td class="text-right" ng-repeat="report in monthlyReport | limitTo: monthlyReport.length - 1">
                        {{ report.totalAEExpenses || 0 | number }}
                    </td>
                    <td class="text-right">
                        {{sumAE(monthlyReport)|| 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Taxi-Shipping
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport" >
                        {{ report.other1 || 0 | number }}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        PO Diem
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport" >
                       {{ report.other2 || 0 | number }}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Marketing Cost
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other3 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Pay Vendor
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport" >
                       {{ report.other4 || 0 | number }}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Office Supplies
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other5 || 0 | number }}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Office Rental
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other6 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Office Utilities
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other7 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Office maintenance
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other8 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Office Phone & Mobile
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other9 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Pay Interest
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other10 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Others
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other11 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Taxes
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{ report.other12 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        Standards
                    </td>
                    <td class="text-right" ng-repeat="report in monthlyReport" >
                        {{ report.other13 || 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td>Profit gain before tax</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{report.totalPOValue - report.totalAEExpenses - report.operationExpenses | number }}
                    </td>
                </tr>
                <tr>
                    <td>Profit tax</td>
                    <td class="text-right" ng-repeat="report in monthlyReport | limitTo: monthlyReport.length - 1" >
                        <a href="#" editable-text="report.tax" buttons="no" blur="submit">{{ report.tax || 0 | number }}</a>
                    </td>
                    <td class="text-right">
                        {{sumTax(monthlyReport)|| 0 | number}}
                    </td>
                </tr>
                <tr>
                    <td>Profit gain after tax</td>
                    <td class="text-right" ng-repeat="report in monthlyReport">
                        {{report.totalPOValue - report.totalAEExpenses - report.operationExpenses - report.tax | number }}
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
    <nav class="navbar navbar-default navbar-fixed-bottom navbar-inverse" role="navigation">
        <div class="container">
            <button class="btn btn-info navbar-btn" ng-click="back()">Back</button>
            <button class="btn btn-info navbar-btn" ng-show="model.id != undefined" busy-click="update(monthlyReport)" success="Updated successfully">Update</button>
            <button class="btn btn-info navbar-btn" ng-hide="model.id != undefined" busy-click="save(monthlyReport)" success="Save successfully">Save</button>
        </div>
    </nav>
</div>
